package com.scoresystem.dao;

import com.scoresystem.dao.proxy.CourseDaoProxy;
import com.scoresystem.dao.proxy.RemarkDaoProxy;
import com.scoresystem.dao.proxy.ScoreDaoProxy;
import com.scoresystem.dao.proxy.StudentDaoProxy;
import com.scoresystem.dao.proxy.SubjectDaoProxy;
import com.scoresystem.dao.proxy.TeacherDaoProxy;
import com.scoresystem.dao.proxy.UserDaoProxy;

public class DaoFactory {
private static DaoFactory instance=null;
	
	private DaoFactory(){}
	
	public synchronized static DaoFactory getInstance() {
		if (instance == null) {
			instance = new DaoFactory();
		}

		return instance;
	}
	
	public ISubjectDao createSubjectDao(){
		ISubjectDao subject=null;
		try{
			subject=new SubjectDaoProxy();
		}
		catch(Exception e){
			e.printStackTrace();
		}
		return subject;
	}
	
	public IUserDao createUserDao(){
		IUserDao userdao=null;
		try{
			userdao=new UserDaoProxy();
		}catch(Exception e){
			e.printStackTrace();
		}
		return userdao;
	}
	
	public IStudentDao createStudentDao(){
		IStudentDao studentdao=null;
		try{
			studentdao=new StudentDaoProxy();
		}catch(Exception e){
			e.printStackTrace();
		}
		return studentdao;
	}
	
	public ITeacherDao createTeacherDao(){
		ITeacherDao teacherdao=null;
		try{
			teacherdao=new TeacherDaoProxy();
		}catch(Exception e){
			e.printStackTrace();
		}
		return teacherdao;
	}
	
	public ICourseDao createCourseDao(){
		ICourseDao coursedao=null;
		try{
			coursedao=new CourseDaoProxy();
		}catch(Exception e){
			e.printStackTrace();
		}
		return coursedao;
	}
	
	public IScoreDao createScoreDao(){
		IScoreDao scoredao=null;
		try{
			scoredao=new ScoreDaoProxy();
		}catch(Exception e){
			e.printStackTrace();
		}
		return scoredao;
	}
	
	public IRemarkDao createRemarkDao(){
		IRemarkDao remarkdao=null;
		try{
			remarkdao=new RemarkDaoProxy();
		}catch(Exception e){
			e.printStackTrace();
		}
		return remarkdao;
	}
	
}
